(function (vc) {
    vc.extends({
        data: {
            resetSystemUserPwdInfo: {}
        },
        _initEvent: function () {
            vc.on('resetSystemUserPwd', 'openResetSystemUserPwd', function (_staffInfo) {
                $that.resetSystemUserPwdInfo = _staffInfo;
                $('#resetSystemUserPwdModel').modal('show');
            });
        },
        methods: {
            closeDeleteStaffModel: function () {
                $('#resetSystemUserPwdModel').modal('hide');
            },
            resetSystemUserPwd: function () {
                let _dataObj = {
                    staffId: $that.resetSystemUserPwdInfo.userId
                };
                vc.http.apiPost(
                    '/user.resetSystemUserPwd',
                    JSON.stringify(_dataObj), {
                        emulateJSON: true
                    },
                    function (json, res) {
                        //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
                        let _json = JSON.parse(json);
                        if (_json.code == 0) {
                            //关闭model
                            $('#resetSystemUserPwdModel').modal('hide');
                            vc.toast("修改密码成功，密码为" + _json.pwd + "请及时修改密码", 10 * 1000);
                            return;
                        } else {
                            vc.toast(_json.msg);
                        }
                    },
                    function (errInfo, error) {
                        console.log('请求失败处理');
                        $that.resetSystemUserPwdInfo.errorInfo = errInfo;
                    }
                );
            }
        }
    });
})(window.vc);